<template>
  <div class="container">
    <p v-for="item in list" :key="item.ID" v-permission="['12001']">
      <el-button size="medium" type="text" @click="downFile(item.download_url)"> {{ item.name }} </el-button>
    </p>
    <br>
  </div>
</template>

<script>
import { getSslist } from '@/api/employee'
import { DOWNURL } from '@/utils/const'
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
      list: []
    }
  },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  mounted() {
    this.init()
  },
  methods: {
    async init() {
      const res = await getSslist()
      if (res.ret === 0) {
        this.list = res.data
      } else {
        this.list = []
      }
    },
    downFile(url) {
      if (this.roles.includes('12002')) {
        window.open(`${DOWNURL}${url}`)
      }
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
